<template>
    <h-section title="人员信息" collapse>
        <div class="section-body">
            <dl>
                <dd class="label">当前处理人：</dd>
                <dt class="cont">
                    {{ getCurrName($store.getters.userInfo.employeeDTO.name) }}
                </dt>
            </dl>
            <dl v-for="(item, index) of taskUserInfo" :key="index">
                <dd class="label">{{ item.taskName }}：</dd>
                <dt class="cont">{{ item.assigneeName }}</dt>
            </dl>
        </div>
    </h-section>
</template>

<script lang="ts">
import store from '@/store';
import { defineComponent, unref, computed } from 'vue';
export default defineComponent({
    props: {
        detail: { type: Object, default: () => ({}) },
        disabled: { type: Boolean, default: false }
    },
    setup() {
        const taskUserInfo = computed(() => {
            return store.state.taskRequire.taskUserInfo;
        });
        const getCurrName = (name) => {
            if (unref(taskUserInfo).length) {
                const targetName = unref(taskUserInfo)[unref(taskUserInfo).length - 1].assigneeName;
                return targetName.indexOf(name) >= 0 ? name : targetName;
            }
        };
        return { taskUserInfo, getCurrName };
    }
});
</script>
<style lang="less" scoped>
.section-body {
    font-size: 14px;
    .label {
        color: @caption-font-color;
    }
    .cont {
        color: @body-font-color;
    }
}
</style>